﻿@using SmartStore.GoogleMerchantCenter;
@model SmartStore.GoogleMerchantCenter.Models.GoogleProductModel
@{
	Layout = "";
}

@* VERY IMPORTANT for proper model binding *@
@Html.Hidden("__Type__", Model.GetType().AssemblyQualifiedName)
@Html.HiddenFor(m => m.ProductId)

<table id="GmcData" class="adminContent">
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Export2)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.Export2)
			@Html.ValidationMessageFor(m => m.Export2)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Taxonomy)
		</td>
		<td class="adminData wide">
			@Html.DropDownListFor(model => model.Taxonomy, (IEnumerable<SelectListItem>)ViewBag.AvailableCategories)
			@Html.ValidationMessageFor(m => m.Taxonomy)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Gender)
		</td>
		<td class="adminData">
			@Html.DropDownListFor(m => m.Gender, (IEnumerable<SelectListItem>)ViewBag.AvailableGenders, (string)ViewBag.DefaultGender)
			@Html.ValidationMessageFor(m => m.Gender)
		</td>
	</tr>	
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.AgeGroup)
		</td>
		<td class="adminData">
			@Html.DropDownListFor(m => m.AgeGroup, (IEnumerable<SelectListItem>)ViewBag.AvailableAgeGroups, (string)ViewBag.DefaultAgeGroup)
			@Html.ValidationMessageFor(m => m.AgeGroup)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.IsAdult)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.IsAdult, new { placeholder = ViewBag.DefaultIsAdult })
			@Html.ValidationMessageFor(m => m.IsAdult)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Color)
		</td>
		<td class="adminData">
			@Html.TextBoxFor(m => m.Color, new { placeholder = ViewBag.DefaultColor })
			@Html.ValidationMessageFor(m => m.Color)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Size)
		</td>
		<td class="adminData">
			@Html.TextBoxFor(m => m.Size, new { placeholder = ViewBag.DefaultSize })
			@Html.ValidationMessageFor(m => m.Size)
		</td>
	</tr>	
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Material)
		</td>
		<td class="adminData">
			@Html.TextBoxFor(m => m.Material, new { placeholder = ViewBag.DefaultMaterial })
			@Html.ValidationMessageFor(m => m.Material)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Pattern)
		</td>
		<td class="adminData">
			@Html.TextBoxFor(m => m.Pattern, new { placeholder = ViewBag.DefaultPattern })
			@Html.ValidationMessageFor(m => m.Pattern)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.Multipack2)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.Multipack2, new { placeholder = ViewBag.DefaultMultipack2 })
			@Html.ValidationMessageFor(m => m.Multipack2)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.IsBundle)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.IsBundle, new { placeholder = ViewBag.DefaultIsBundle })
			@Html.ValidationMessageFor(m => m.IsBundle)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.EnergyEfficiencyClass)
		</td>
		<td class="adminData">
			@Html.DropDownListFor(m => m.EnergyEfficiencyClass, (IEnumerable<SelectListItem>)ViewBag.AvailableEnergyEfficiencyClasses, (string)ViewBag.DefaultEnergyEfficiencyClass)
			@Html.ValidationMessageFor(m => m.EnergyEfficiencyClass)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.CustomLabel0)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.CustomLabel0, new { placeholder = ViewBag.DefaultCustomLabel })
			@Html.ValidationMessageFor(m => m.CustomLabel0)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.CustomLabel1)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.CustomLabel1, new { placeholder = ViewBag.DefaultCustomLabel })
			@Html.ValidationMessageFor(m => m.CustomLabel1)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.CustomLabel2)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.CustomLabel2, new { placeholder = ViewBag.DefaultCustomLabel })
			@Html.ValidationMessageFor(m => m.CustomLabel2)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.CustomLabel3)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.CustomLabel3, new { placeholder = ViewBag.DefaultCustomLabel })
			@Html.ValidationMessageFor(m => m.CustomLabel3)
		</td>
	</tr>
	<tr>
		<td class="adminTitle">
			@Html.SmartLabelFor(m => m.CustomLabel4)
		</td>
		<td class="adminData">
			@Html.EditorFor(m => m.CustomLabel4, new { placeholder = ViewBag.DefaultCustomLabel })
			@Html.ValidationMessageFor(m => m.CustomLabel4)
		</td>
	</tr>
</table>

<script type="text/javascript">
	$(function () {

		$('#@Html.FieldIdFor(model => model.Taxonomy)').select2({
			width: 'style',
			dropdownAutoWidth: true,
			allowClear: true,
			theme: 'bootstrap',
			closeOnSelect: true,
			placeholder: '@Html.Raw(ViewBag.DefaultCategory)',
			language: '@ViewBag.LanguageSeoCode',
			ajax: {
				delay: 300,
				cache: true,
				dataType: 'json',
				type: 'GET',
				url: '@Url.Action("GetGoogleCategories", "FeedGoogleMerchantCenter", new { Namespaces = "SmartStore.GoogleMerchantCenter.Controllers", area = GoogleMerchantCenterFeedPlugin.SystemName })',
				data: function (params) {
					var query = {
						search: params.term,
						page: params.page || 1
					}
					return query;
				},
				processResults: function (data, params) {
					params.page = params.page || 1;

					return {
						results: data.results,
						pagination: {
							more: data.hasMoreItems
						}
					};
				}
			}
		});

	});
</script>
